<!--
  @author yangjiangming
  @date 2018-12-10 20:40:28
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html th:replace="~{work/modify/common/layout :: layout('算账', ~{::title}, ~{::content}, ~{::script})}"
      xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <title>工单管理-算账</title>
</head>
<body>

<th:block th:fragment="templates">
    <!--内采配件-->
    <script type="text/html" id="part-inSourcingAmount">
        <p>{{d.inSourcingAmount / 100}}</p>
    </script>
    <!--外报配件-->
    <script type="text/html" id="part-outSourcingAmount">
        <p>{{d.outSourcingAmount / 100}}</p>
    </script>
    <!--杂运费-->
    <script type="text/html" id="part-deliverAmount">
        <p>{{d.deliverAmount / 100}}</p>
    </script>
    <!--总计配件-->
    <script type="text/html" id="part-partAmount">
        <p>{{d.partAmount / 100}}</p>
    </script>

    <!--工程师绩效基数-->
    <script type="text/html" id="billAmount">

        {{#  if(d.masterTypeName == '主工程师'){    }}
        <!--<p class="tpl-input">{{(d.billAmount / 100).toFixed(2)}}</p>-->
        <input class="tpl-input mainbillAmount" type="text" value="{{(d.billAmount / 100)}}" name="billAmount"
               autocomplete="off" disabled>
        {{#   }else{  }}
        <input class="tpl-input billAmount" type="text" value="{{(d.billAmount / 100)}}" name="billAmount"
               autocomplete="off" placeholder="请输入">
        {{#   }  }}
    </script>
    <!--绩效基数补贴-->
    <script type="text/html" id="subsidyAmount">
        {{#  if(d.masterTypeName == '主工程师'){    }}
        <input class="tpl-input subsidyAmount" type="text" value="{{d.subsidyAmount / 100}}" name="subsidyAmount"
               autocomplete="off" placeholder="请输入">
        {{#   }       }}
    </script>
    <!--返修奖励-->
    <script type="text/html" id="deductAmount">
        <input class="tpl-input deductAmount" type="text" value="{{d.deductAmount / 100}}" name="deductAmount"
               autocomplete="off" placeholder="请输入">
    </script>
    <!--返修扣款-->
    <script type="text/html" id="reworkRewardAmount">
        <input class="tpl-input reworkRewardAmount" type="text" value="{{d.reworkRewardAmount / 100}}" name="reworkRewardAmount"
               autocomplete="off" placeholder="请输入">
    </script>
    <!--基础提留-->
    <script type="text/html" id="rewardAmount">
        <input class="tpl-input rewardAmount" type="text" value="{{(d.rewardAmount / 100).toFixed(2)}}" name="rewardAmount"
               disabled>
    </script>
    <!--工程师提成-->
    <script type="text/html" id="rewardAmountForSimple">
        <input class="tpl-input rewardAmount" type="text" name="rewardAmount" autocomplete="off" lay-verify="required" placeholder="请输入">
    </script>

    <!--提留补贴-->
    <script type="text/html" id="rewardSubsidyAmount">
        {{#  if(d.masterTypeName == '主工程师'){    }}
        <input class="tpl-input mainrewardSubsidyAmount rewardSubsidyAmount" type="text"
               value="{{d.rewardSubsidyAmount / 100}}" name="rewardSubsidyAmount" autocomplete="off" placeholder="请输入">
        {{#   }else{       }}
        <input class="tpl-input rewardSubsidyAmount" type="text" value="{{d.rewardSubsidyAmount / 100}}"
               name="rewardSubsidyAmount" autocomplete="off" placeholder="请输入">
        {{#   }  }}
    </script>
    <!--固定提留-->
    <script type="text/html" id="rewardValuefixed">
        <input class="tpl-input rewardValue" type="text" value="{{accountVo.rewardValue / 100}}" name="rewardValue"
               disabled>
    </script>
    <!--基础提留-->
    <script type="text/html" id="rewardAmountfixed">
        <input class="tpl-input rewardAmount" type="text" value="{{d.rewardAmount/100}}" name="rewardAmount" disabled>
    </script>

    <!--特殊补贴-->
    <script type="text/html" id="specialBenefit">
        <input class="tpl-input-spe specialBenefit" type="text"  name="specialBenefit" autocomplete="off" placeholder="请输入">
    </script>
    <!--春节补贴-->
    <script type="text/html" id="springSubsidyRate">
        <p>{{d.springSubsidyRate}}%</p>
    </script>
    <!--标准服务奖励-->
    <script type="text/html" id="bonus">
        <p>{{d.bonus/100}}</p>
    </script>

    <!-- 算账明细模板 -->
    <script  type="text/html" id="template-account-detail-apportion">
        <div class="layui-card">
            <div class="layui-card-header">{{ title }}</div>
            <div class="layui-card-body">
                <table class="layui-table">
                    <colgroup>
                        <col>
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>分摊人</th>
                        <th>分摊金额（元）</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>平台</td>
                        <td>{{ data.plat | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>信息公司</td>
                        <td>{{ data.infoCompany | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>工程师</td>
                        <td>{{ data.master | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>下单渠道</td>
                        <td>{{ data.channel | fenToYuan }}</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </script>

    <script  type="text/html" id="template-account-detail">
        <div class="layui-card card-try-account-detail">
            <div class="layui-card-body" v-if="orderSettleInfo.isCurrentOrderSelfRun">
                <table class="layui-table">
                    <colgroup>
                        <col>
                        <col>
                        <col>
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>工程师</th>
                        <th></th>
                        <th>金额项目</th>
                        <th>金额</th>
                    </tr>
                    </thead>
                    <tbody>
                    <template v-for="masterInfo in orderSettleInfo.masterAmountInfos">
                        <tr>
                            <td rowspan="16">{{ masterInfo.masterName }}</td>
                            <td rowspan="7">维修费</td>
                            <td>工程师基础分润</td>
                            <td>{{ masterInfo.basicShare | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td>工程师品类补贴</td>
                            <td>{{ masterInfo.subsidyCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td>工程师绩效奖励</td>
                            <td>{{ masterInfo.kpiCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td>激励金</td>
                            <td>{{ masterInfo.standardServiceCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td>春节期间补贴</td>
                            <td>{{ masterInfo.springCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td>特殊补贴</td>
                            <td>{{ masterInfo.specialCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td>工程师税费分摊</td>
                            <td>{{ masterInfo.taxShare | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td rowspan="3">优惠分摊</td>
                            <td>优惠券分摊-工程师分摊</td>
                            <td>{{ masterInfo.voucherShare | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td>优惠减免及分摊-工程师分摊</td>
                            <td>{{ masterInfo.artificialPreferences | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td>积分抵扣及分摊-工程师分摊</td>
                            <td>{{ masterInfo.integralCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td rowspan="1">罚金</td>
                            <td>返修罚金</td>
                            <td>{{ masterInfo.reworkCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td rowspan="1">质保金</td>
                            <td>质保金</td>
                            <td>{{ masterInfo.depositCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td rowspan="2">保险费用</td>
                            <td>保险费</td>
                            <td>{{ masterInfo.insuranceCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td>保险互助金</td>
                            <td>{{ masterInfo.helpCost | fenToYuan }}</td>
                        </tr>
                        <tr>
                            <td rowspan="2">提留汇总</td>
                            <td>提留共计</td>
                            <td>{{ masterInfo | commissionAmount }}</td>
                        </tr>
                        <tr>
                            <td>提留占比</td>
                            <td>{{ masterInfo | commissionRate(orderSettleInfo) }}</td>
                        </tr>
                    </template>
                    <template v-if="orderSettleInfo.isSourceOrderSelfRun != null && !orderSettleInfo.isSourceOrderSelfRun">
                        <tr>
                            <th>{{ orderSettleInfo.sourceInfoCompanyAmountInfo.manageCompanyName }}</th>
                            <th>罚金与扣款</th>
                            <th>返修罚金</th>
                            <th>{{ orderSettleInfo.sourceInfoCompanyAmountInfo.reworkCost | fenToYuan }}</th>
                        </tr>
                    </template>
                    </tbody>
                </table>
                <p class="account-explain">说明：预算账结果可能与实际结果有误差，原因可能为：在点击确认结果期间，订单修改了金额信息或更改了分润配置；</p>
                <button class="layui-btn" type="button" id="confirm-account" @click="$emit('account')">确认结果</button>
            </div>
            <div class="layui-card-body" v-else>
                <table class="layui-table">
                    <colgroup>
                        <col>
                        <col>
                        <col>
                        <col>
                    </colgroup>
                    <thead>
                    <tr>
                        <th>服务商</th>
                        <th></th>
                        <th>金额项目</th>
                        <th>金额</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td rowspan="16">{{ orderSettleInfo.infoCompanyAmountInfo.manageCompanyName }}</td>
                        <td rowspan="7">订单服务费</td>
                        <td>基础分润</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.basicShare | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>品类补贴</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.subsidyCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>绩效奖励</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.kpiCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>激励金</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.standardServiceCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>春节期间补贴</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.springCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>特殊补贴</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.specialCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>税费分摊</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.taxShare | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td rowspan="3">优惠分摊</td>
                        <td>优惠券分摊-服务商分摊</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.voucherShare | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>优惠减免及分摊-服务商分摊</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.artificialPreferences | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>积分抵扣及分摊-服务商分摊</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.integralCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td rowspan="2">罚金与扣款</td>
                        <td>返修罚金</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.reworkCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>质保金</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.depositCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td rowspan="2">保险费用</td>
                        <td>保险费</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.insuranceCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td>保险互助金</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo.helpCost | fenToYuan }}</td>
                    </tr>
                    <tr>
                        <td rowspan="2">提留汇总</td>
                        <td>提留共计</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo | companyCommissionAmount }}</td>
                    </tr>
                    <tr>
                        <td>提留占比</td>
                        <td>{{ orderSettleInfo.infoCompanyAmountInfo | companyCommissionRate(orderSettleInfo) }}</td>
                    </tr>
                    <template v-if="orderSettleInfo.isSourceOrderSelfRun">
                        <template v-for="masterInfo in orderSettleInfo.masterAmountInfos">
                            <tr>
                                <td >{{ masterInfo.masterName }}</td>
                                <td >罚金与扣款</td>
                                <td>返修罚金</td>
                                <td>{{ masterInfo.reworkCost | fenToYuan }}</td>
                            </tr>
                        </template>
                    </template>
                    <template v-if="orderSettleInfo.isSourceOrderSelfRun != null && !orderSettleInfo.isSourceOrderSelfRun">
                        <tr>
                            <th>{{ orderSettleInfo.sourceInfoCompanyAmountInfo.manageCompanyName }}</th>
                            <th>罚金与扣款</th>
                            <th>返修罚金</th>
                            <th>{{ orderSettleInfo.sourceInfoCompanyAmountInfo.reworkCost | fenToYuan }}</th>
                        </tr>
                    </template>
                    </tbody>
                </table>
                <p class="account-explain">说明：预算账结果可能与实际结果有误差，原因可能为：在点击确认结果期间，订单修改了金额信息或更改了分润配置；</p>
                <button class="layui-btn" type="button" id="confirm-account" @click="$emit('account')">确认结果</button>
            </div>
        </div>
    </script>
</th:block>

</body>
</html>